package com.qianfeng.exam.mapper;

import com.qianfeng.exam.pojo.Authors;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public interface AuthorsMapper {
    @Insert("insert into authors(authorname,authordescription)value(#{authorName},#{authorDescription})")
    @Options(useGeneratedKeys=true,keyProperty="authorid")//添加记录并返回数据库自增加的ID
    void addAuthor(Authors authors);

    @Select("select * from authors")
    List<Authors> findAllUsers();
}
